/**
 * @param {string[]} tokens
 * @return {number}
 */
var evalRPN = function (tokens) {
  let stack = []
  let map = {
    '+': (a, b) => a * 1 + b * 1,
    '-': (a, b) => b - a,
    '*': (a, b) => a * b,
    // '/': (a, b) => b / a | 0
    '/': (a, b) => b / a > 0 ? Math.floor(b / a) : Math.ceil(b / a)
  }
  for (let i of tokens) {
    if (!map[i]) {
      stack.push(i)
      continue
    }
    let b = stack.pop() // -132
    let a = stack.pop() // 6 要算的是-132/6
    let res = map[i](b, a)
    console.log(res);
    stack.push(res)
  }
  return stack[0]
};
let tokens = ["10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"]
console.log(evalRPN(tokens));